package client;

import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;

/**
 * These enums each represent a {@link JPanel} to be displayed when pressing 
 * a button of a certain type of alcohol. Each enum also contains
 * a String label to be displayed on the corresponding button.
 * 
 * @author Fredrik Bystam
 * @version 2011.10.17
 *
 */
public enum SettingsPanels {
	
	BEER ("Beer") {
		@Override protected void buildPanel() {
			buildBeerPanel(BEER.panel);
			
		}
	},
	CIDER ("Cider") {
		@Override protected void buildPanel() {
			buildCiderPanel(CIDER.panel);
		}
	},
	LIQUOR ("Liquor") {
		@Override protected void buildPanel() {
			buildLiquorPanel(LIQUOR.panel);
		}
	},
	WINE ("Wine") {
		@Override protected void buildPanel() {
			buildWinePanel(WINE.panel);
		}
	};
	
	
	private final JPanel panel = new JPanel();
	private final String buttonLabel;
	private boolean panelIsBuilt;
	
	private SettingsPanels(String label){
		buttonLabel = label;
	}
	
	/**
	 * Build the panel contained in each specific enum.
	 * Override and implement to adjust.
	 */
	protected abstract void buildPanel();

	/**
	 * Retrieves the {@link JPanel} contained in an enum. The contains 
	 * of the panel is built lazily (the first time 
	 * you call this method.
	 * @return The panel associated with this enum
	 */
	public JPanel getPanel(){
		if (!panelIsBuilt)  {
			buildPanel();
			panelIsBuilt = true;
		}
		return panel;
	}

	public String getButtonLabel() {
		return buttonLabel;
	}
	
	/**
	 * The input parameter {@link JPanel} will be built to look
	 * like the settings panel for beer.
	 * @param panel The inserted panel to be built
	 */
	private static void buildBeerPanel(JPanel panel){
		// TODO Design Beer settings panel
	}
	
	/**
	 * The input parameter {@link JPanel} will be built to look
	 * like the settings panel for cider.
	 * @param panel The inserted panel to be built
	 */
	private static void buildCiderPanel(JPanel panel){
		// TODO Design Cider settings panel
	}
	
	/**
	 * The input parameter {@link JPanel} will be built to look
	 * like the settings panel for liquor.
	 * @param panel The inserted panel to be built
	 */
	private static void buildLiquorPanel(JPanel panel){
		// TODO Design Liquor settings panel
	}
	
	/**
	 * The input parameter {@link JPanel} will be built to look
	 * like the settings panel for wine.
	 * @param panel The inserted panel to be built
	 */
	private static void buildWinePanel(JPanel panel) {
		// TODO Design Wine settings panel
	}
}
